import request from '@/utils/request'

const workFlowPrefix = '/workflow'

const uumsPrefix = '/uums'

// 获取业务类型树形结构
export function wfBusiTypeTree(args) {
  return request({
    url: workFlowPrefix + '/WfBusiType/treeSelect?',
    method: 'POST',
    data: args
  })
}

// 查询业务类型
export function wfBusiTypeSelect(args) {
  return request({
    url: workFlowPrefix + '/WfBusiType/select',
    method: 'POST',
    data: args
  })
}

// 插入业务类型
export function wfBusiTypeInsert(args) {
  return request({
    url: workFlowPrefix + '/WfBusiType',
    method: 'POST',
    data: args
  })
}

// 更新业务类型（通过主键ID）
export function wfBusiTypeUpdateById(args) {
  return request({
    url: workFlowPrefix + '/WfBusiType/' + args.busiTypeId,
    method: 'PUT',
    data: args
  })
}

// 删除业务类型（通过主键ID）
export function wfBusiTypeDelete(args) {
  return request({
    url: workFlowPrefix + '/WfBusiType/force',
    method: 'DELETE',
    data: args
  })
}

// 获取机构树形结构
export function wfBusiTypeProcessOrgTree(args) {
  return request({
    url: workFlowPrefix + '/WfBusiTypeProcess/selectOrgTree',
    method: 'POST',
    data: args
  })
}

// 获取业务已经关联的流程
export function wfBusiTypeProcessSelect(args) {
  return request({
    url: workFlowPrefix + '/WfBusiTypeProcess/selectHasProcess?busiTypeId=' + args.busiTypeId + '&orgId=' + args.orgId,
    method: 'POST',
    data: args
  })
}

// 插入业务关联的流程
export function wfBusiTypeProcessInsert(args) {
  return request({
    url: workFlowPrefix + '/WfBusiTypeProcess',
    method: 'POST',
    data: args
  })
}

// 更新业务关联的流程
export function wfBusiTypeProcessUpdateById(args) {
  return request({
    url: workFlowPrefix + '/WfBusiTypeProcess/' + args.busiTypeProcId,
    method: 'PUT',
    data: args
  })
}

// 删除业务关联的流程
export function wfBusiTypeProcessDelete(args) {
  return request({
    url: workFlowPrefix + '/WfBusiTypeProcess/force/batch',
    method: 'DELETE',
    data: args
  })
}

// 查询所有可用按钮
export function wfBusiProcButtonAll(args) {
  return request({
    url: uumsPrefix + '/FreeCertification/SysCodeCommon/getSysCodeList?codeType=' + args.codeType + '&codeStatus=' + args.codeStatus,
    method: 'POST',
    data: args
  })
}

// 查询激活版本流程的节点（手动）列表
export function wfBusiProcActSelect(args) {
  return request({
    url: workFlowPrefix + '/WfBusiProcButton/getAllActOfActiveProcess?processId=' + args.procId ,
    method: 'POST',
    data: args
  })
}

// 查询已配置按钮按钮
export function wfBusiProcButtonSelect(args) {
  return request({
    url: workFlowPrefix + '/WfBusiProcButton/select?busiTypeProcId=' + args.busiTypeProcId + '&actId=' + args.actId,
    method: 'POST',
    data: args
  })
}

// 保存配置按钮按钮
export function wfBusiProcButtonInsert(args) {
  return request({
    url: workFlowPrefix + '/WfBusiProcButton/batch',
    method: 'POST',
    data: args
  })
}

// 删除已配置按钮按钮
export function wfBusiProcButtonDelete(args) {
  return request({
    url: workFlowPrefix + '/WfBusiProcButton/force/batch',
    method: 'DELETE',
    data: args
  })
}

